package com.example.mybatisplus.config;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.example.mybatisplus.constant.BusinessConstant;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * @author admin
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class BaseEntity implements Serializable {

    @TableField(fill = FieldFill.INSERT)
    @DateTimeFormat(pattern = BusinessConstant.DateFormat.DATE_TIME_FORMAT)
    @JsonFormat(pattern = BusinessConstant.DateFormat.DATE_TIME_FORMAT, timezone = "GMT+8")
    private LocalDateTime createTime;

    @TableField(fill = FieldFill.INSERT)
    private Long createUser;

    @TableField(fill = FieldFill.INSERT)
    private String createUserName;

    @TableField(fill = FieldFill.INSERT_UPDATE)
    @DateTimeFormat(pattern = BusinessConstant.DateFormat.DATE_TIME_FORMAT)
    @JsonFormat(pattern = BusinessConstant.DateFormat.DATE_TIME_FORMAT, timezone = "GMT+8")
    private LocalDateTime updateTime;

    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Long updateUser;

    @TableField(fill = FieldFill.INSERT_UPDATE)
    private String updateUserName;

    private Integer delFlag;

}
